#include "util/tc_common.h"
#include "sys/shm.h"
#include "unistd.h"

using namespace std;
using namespace taf;

int main(int argc, char** argv)
{
    int ishm;
    
    ishm = shmget(4012, 1024, IPC_CREAT|IPC_EXCL|0666);
    if (ishm < 0)
    {
        cout << "shmget create error" << endl;
    }
    cout << "shmget create success:" << ishm << endl;

    ishm = shmget(4012, 1024, 0666);
    if (ishm < 0)
    {
        cout << "shmget 1 error" << endl;
    }
    cout << "shmget 1 success:" << ishm << endl;
    
    ishm = shmget(4012, 1024, 0666);
    if (ishm < 0)
    {
        cout << "shmget 2 error" << endl;
    }
    cout << "shmget 2 success:" << ishm << endl;

    shmctl(ishm, IPC_RMID, 0); 
    return 0;
}
